home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / clipper / nfsrc21.zip / ADAPTER.ASM < prev    next >
Assembly Source File  |  1991-08-15  |  3KB  |  113 lines

  1. ; File......: ADAPTER.ASM
  2. ; Author....: Ted Means
  3. ; Date......: $Date:   15 Aug 1991 23:07:18  $
  4. ; Revision..: $Revision:   1.2  $
  5. ; Log file..: $Logfile:   E:/nanfor/src/adapter.asv  $
  6. ; This is an original work by Ted Means and is placed in the
  7. ; public domain.
  8. ;
  9. ; Modification history:
  10. ; ---------------------
  11. ;
  12. ; $Log:   E:/nanfor/src/adapter.asv  $
  13. ;  
  14. ;     Rev 1.2   15 Aug 1991 23:07:18   GLENN
  15. ;  Forest Belt proofread/edited/cleaned up doc
  16. ;  
  17. ;     Rev 1.1   14 Jun 1991 19:54:18   GLENN
  18. ;  Minor edit to file header
  19. ;  
  20. ;     Rev 1.0   01 Apr 1991 01:03:08   GLENN
  21. ;  Nanforum Toolkit
  22. ;  
  23. ;
  24.  
  25.  
  26.  
  27. ;  $DOC$
  28. ;  $FUNCNAME$
  29. ;     FT_ADAPTER()
  30. ;  $CATEGORY$
  31. ;     Video
  32. ;  $ONELINER$
  33. ;     Report the type of video adapter installed
  34. ;  $SYNTAX$
  35. ;     FT_ADAPTER() -> nResult
  36. ;  $ARGUMENTS$
  37. ;     None
  38. ;  $RETURNS$
  39. ;     Integer representing type of video adapter
  40. ;
  41. ;        0 - monochrome
  42. ;        1 - CGA
  43. ;        2 - EGA
  44. ;        3 - VGA
  45. ;  $DESCRIPTION$
  46. ;     This function is valuable if you use a graphics library and need to
  47. ;     know what type of graphics adapter is installed.
  48. ;
  49. ;     The source code is written to adhere to Turbo Assembler's IDEAL mode.
  50. ;     To use another assembler, you will need to rearrange the PROC and
  51. ;     SEGMENT directives, and also the ENDP and ENDS directives (a very
  52. ;     minor task).
  53. ;  $EXAMPLES$
  54. ;     iVideo := FT_ADAPTER()
  55. ;
  56. ;     DO CASE
  57. ;        CASE iVideo == 0
  58. ;           QOUT( "You have a monochrome adapter." )
  59. ;        CASE iVideo == 1
  60. ;           QOUT( "You have a CGA adapter." )
  61. ;        CASE iVideo == 2
  62. ;           QOUT( "You have an EGA adapter." )
  63. ;        CASE iVideo == 3
  64. ;           QOUT( "You have a VGA adapter." )
  65. ;     ENDCASE
  66. ;  $SEEALSO$
  67. ;     FT_SETMODE()
  68. ;  $END$
  69. ;
  70.  
  71.          IDEAL
  72.  
  73. Public   FT_ADAPTER
  74.  
  75. Extrn    __RetNI:Far
  76.  
  77. Segment  _NanFor   Word      "CODE"
  78.          Assume    CS:_NanFor
  79.  
  80. Proc     FT_ADAPTER          Far
  81.  
  82.          Xor       BX,BX                     ; Clear BX
  83.          Mov       ES,BX                     ; Set ES to low memory
  84.          Cmp       [Word Ptr ES:463h],3B4h   ; See if mono
  85.          JE        Done                      ; If so, we're done
  86.  
  87. IsVGA:   Mov       AX,1A00h                  ; VGA-only BIOS call
  88.          Int       10h                       ; Call video BIOS
  89.          Cmp       AL,1Ah                    ; See if call supported
  90.          JNE       IsEGA                     ; If not, try EGA
  91.          Mov       BX,3                      ; Indicate VGA
  92.          JMP       Short Done                ; Return to application
  93.  
  94. IsEGA:   Mov       AH,12h                    ; EGA-only BIOS call
  95.          Mov       BL,10h                    ; Set BL to test value
  96.          Int       10h                       ; Call video BIOS
  97.          Cmp       BL,10h                    ; Did BL change?
  98.          JE        IsCGA                     ; No, so it's a CGA
  99.          Mov       BX,2                      ; Indicate EGA
  100.          Jmp       Short Done                ; Return to application
  101.  
  102. IsCGA:   Mov       BX,1                      ; Indicate CGA
  103.  
  104. Done:    Push      BX                        ; Save adapter type on stack
  105.          Call      __RetNI                   ; Return it
  106.          Add       SP,2                      ; Realign stack
  107.          Ret
  108. Endp     FT_ADAPTER
  109. Ends     _NanFor
  110. End
  111. 
  112.